home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -websites- / wirenet / files / thor26_arexx.lha / Rexx / RePostEN.thor < prev    next >
Text File  |  1999-01-17  |  3KB  |  140 lines

  1. /* $VER: RePostEN.thor 3.2 (8.11.97)
  2.  *
  3.  * Originally: RePostEN.thor 3.1 (02.09.1994)
  4.  *
  5.  * Arexx script to repost messages from a BBS to conferences on another.
  6.  *
  7.  *  Script by: Eivind Nordseth, Ultima Thule Software.
  8.  *
  9.  *  Script fixed by: Gary Evans, 1997
  10.  */
  11.  
  12. options results
  13.  
  14. /* trace results */
  15.  
  16. if(substr(address(),1,4) ~= "THOR") then do
  17.         parse arg thorport
  18.         if~(show(p, thorport)) then do
  19.                 if ~(show(p, "THOR.01")) then do
  20.                         say "No THOR port found!"
  21.                         exit
  22.                 end
  23.                 else thorport = "THOR.01"
  24.         end
  25. end
  26. else thorport = address()
  27.  
  28. if ~show('p', 'BBSREAD') then do
  29.         address command
  30.                 "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  31.                 "WaitForPort BBSREAD"
  32. end
  33.  
  34. address(thorport)
  35.  
  36. CURRENTMSG stem MSG
  37. if(rc ~= 0) then 
  38. do 
  39.         REQUESTNOTIFY TEXT '"No current message."' BT '"_Ok"'
  40.         exit
  41. end
  42.  
  43. address BBSREAD GETBBSLIST stem BBSLIST
  44. if(rc ~= 0) then
  45. do
  46.         address(thorport)
  47.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  48.         exit
  49. end
  50.  
  51. REQUESTLIST instem BBSLIST outstem TOBBS title '"Select BBS to repost to"'
  52. if(rc ~= 0) then 
  53. do
  54.         if(rc ~= 5) then address(thorport) REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  55.         exit
  56. end 
  57.  
  58. dobbs = result
  59.  
  60. address BBSREAD GETCONFLIST bbsname '"'dobbs'"' stem CONFLIST
  61. if(rc ~= 0) then 
  62. do
  63.         address(thorport)
  64.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  65.         exit
  66. end
  67.  
  68. REQUESTLIST instem CONFLIST outstem TOCONF title '"Select Conference"'
  69. if(rc ~= 0) then 
  70. do
  71.         if(rc ~= 5) then address(thorport) REQUESTNOTIFY TEXT '"'THOR.LASTERROR BT'"' '"_Ok"'
  72.         exit
  73. end
  74. doconf = result
  75.  
  76. address BBSREAD
  77.  
  78. drop FILE.
  79.  
  80. UNIQUEMSGFILE bbsname '"'dobbs'"' stem FILE
  81. if(rc ~= 0) then 
  82. do
  83.         address(thorport)
  84.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  85.         exit
  86. end
  87.  
  88. READBRMESSAGE bbsname '"'MSG.BBSNAME'"' confname '"'MSG.CONFNAME'"' msgnr MSG.MSGNR headstem HEADTAGS textstem TEXTTAGS datastem DATATAGS
  89. if(rc ~= 0) then 
  90. do
  91.         address(thorport)
  92.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  93.         exit
  94. end
  95.  
  96. if(~open('data',FILE.NAME,A)) then
  97.  do
  98.        address(thorport)
  99.        REQUESTNOTIFY TEXT '"Unable to open file:"' FILE.NAME '"' BT '"_Ok"'
  100.        exit
  101.  end
  102.  
  103. msgfrom = HEADTAGS.FROMNAME
  104.  if symbol("HEADTAGS.FROMADDR") = "VAR" then msgfrom = msgfrom || ' <' || HEADTAGS.FROMADDR || '>'
  105.  
  106.  
  107.  if(MSG.CONFNAME ~= doconf) then
  108.  do
  109.     call writeln('data', 'Message crossposted from: ' || MSG.CONFNAME)
  110.  end
  111.  call writeln('data', 'Originally written by: ' || msgfrom || '0a'x)
  112.  call writeln('data', 'Subject: ' || HEADTAGS.SUBJECT || '0a'x)
  113.  
  114.  do n=1 to TEXTTAGS.TEXT.COUNT
  115.        call writeln('data', TEXTTAGS.TEXT.n)
  116.  end
  117.  
  118. call close('data')
  119.  
  120. if(HEADTAGS.TONAME = 'HEADTAGS.TONAME') then HEADTAGS.TONAME = 'All'
  121. if(HEADTAGS.TOADDR = 'HEADTAGS.TOADDR') then HEADTAGS.TOADDR = ''
  122.  
  123. drop EVENT.
  124.  
  125. EVENT.TONAME = HEADTAGS.TONAME
  126. EVENT.TOADDR = HEADTAGS.TOADDR
  127. EVENT.SUBJECT = HEADTAGS.SUBJECT
  128. EVENT.CONFERENCE = doconf
  129. EVENT.REFNR = HEADTAGS.REFNR
  130. EVENT.MSGFILE = FILE.FILEPART
  131.  
  132. WRITEBREVENT bbsname '"'dobbs'"' event 0 stem EVENT
  133. if(rc ~= 0) then 
  134. do
  135.         address(thorport)
  136.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  137.         address command 'Delete >nil: '||'"'||FILE.NAME||'"'
  138.         exit
  139. end
  140.